package com.mg.framework.tiled;

import java.util.Properties;

public abstract class MapLayer {

	protected Rectangle bounds;
	protected Map map;
	private String name;
	private Properties properties = new Properties();

	public MapLayer() {
		bounds = new Rectangle();
		setMap(null);
	}

	public void setMap(Map map) {
		this.map = map;
	}

	public MapLayer(int w, int h) {
		this(new Rectangle(w, h));
	}

	public MapLayer(Rectangle r) {
		this();
		setBounds(r);
	}

	protected void setBounds(Rectangle bounds) {
		this.bounds = new Rectangle(bounds);
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return this.name;
	}

	public boolean isMe(String name) {
		return this.name.equals(name);
	}

	public Properties getProperties() {
		return properties;
	}

	public int getWidth() {
		return bounds.width;
	}

	public int getHeight() {
		return bounds.height;
	}

	public void setProperties(Properties p) {
		properties.clear();
		properties.putAll(p);
	}
}
